#include <iostream>

using namespace std;

template <typename T> void swap2num(T &a, T &b); // 模板函数 or 函数模板
template <class T> T max3num(T &a, T &b, T &c);

int main(void)
{
    int n1 = 1, n2 = 2;
    float f1 = 1.1, f2 = 2.2;
    int a = 1, b = 3, c = 2;

    swap2num(n1, n2);
    swap2num(f1, f2);

    cout << n1 << ", " << n2 << endl;
    cout << f1 << ", " << f2 << endl;

    cout << "max: " << max3num(a, b, c) << endl;
    
    return 0;
}

template <typename T> void swap2num(T &a, T &b)
{
    T tmp;
    tmp = a;
    a = b;
    b = tmp;
}

template <class T> T max3num(T &a, T &b, T &c)
{
    T tmp = a > b ? a : b;
    return tmp > c ? tmp : c;
}

